#! /bin/bash

# $1 测试的次数
# $2 测试的起始规模
# $3 测试的增量
# $4 测试的重复次数

n=$2
echo "re = ["
for i in $(seq 1 $1)
do
	re=`./test $n $4 | grep time | ./timer/timer`
	echo $n ${re#*:}
	n=$(($n+$3))
done

echo "];"

echo "plot(re(:, 1), re(:, 2)./(re(:, 1).*log(re(:, 1))), '.', 'MarkerSize', 10);" 
echo "xlabel('Problem Size: n');"
echo "ylabel('Time Efficiency: t_n/nlogn');"
echo "set(gca, 'FontSize', 20);"
echo "saveas(gcf, 'result.pdf');"
